    var bdmusic = {
      now_type:1,
      offset:0,
      sizes:20,
      baseUrl: 'http://tingapi.ting.baidu.com/v1/restserver/ting',
      typeList:{
        1:'最新歌曲榜',
        2:'热门歌曲榜',
        11:'热门摇滚歌曲',
        14:'热门影视歌曲',
        20:'华语金曲榜',
        21:'欧美金曲榜',
        22:'经典老歌榜',
        23:'热门对唱歌曲',
        25:'热门网络歌曲'
      },
      query: function(query,callback){
        $.ajax({
          type:'get',
          dataType:'jsonp',
          url:bdmusic.baseUrl + '?' + query,
          timeout:5000,
          success:function(data){
            callback(data);
          },
          error:function(hxr,status,err){
            alert(err);
          }
        });
      },
      getList: function(type,offsets,sizes){
        var type = parseInt(type);
        if(bdmusic.typeList[type] === undefined) type = 1;
        var query = 'method=baidu.ting.billboard.billList&type='+type+'&size='+sizes+'&offset='+offsets;
        bdmusic.query(query,function(data){
            var str = '';
            var songs = data.song_list;
            for(var s in songs){
              str += '<div class="songp"><a onclick="bdmusic.getsong('+songs[s].song_id+')"><img src="'+songs[s].pic_small+'"/>'+songs[s].title+'</a></div>';
            }
          $('#songlist').html(str);
        });
      },
      getType: function(type){
        if(type != bdmusic.now_type){
          bdmusic.now_type = type;
          bdmusic.offset = 0;
        }
        bdmusic.getList(bdmusic.now_type,bdmusic.offset,bdmusic.sizes);
      },
      getsong: function(songid){
        var query = 'method=baidu.ting.song.play&songid='+songid;
        bdmusic.query(query,function(data){
          $('#videos').attr('src',data.bitrate.file_link);
          $('#songtitle').html(data.songinfo.title);
          videos.play();
        });
      },
      getlrc: function(songid){
        var query = 'method=baidu.ting.song.lry&songid='+songid
        bdmusic.query(query,function(data){
          console.log(data);
        })
      },
      searchsong:function(title){
        var query = 'method=baidu.ting.search.catalogSug&query='+title;
        bdmusic.query(query,function(data){
          console.log(data);
          if(data.artist){
            var artstr = "歌手: ";
            var arts = data.artist;
            for(var a in arts){
              artstr += '<a onclick="bdmusic.artsong('+arts[a].artistid+')" class="artp"><img src="'+arts[a].artistpic+'" />'+arts[a].artistname+'</a> |';
            }
            $('#artlist').html(artstr);
          }
          if(data.song){
            var str = '';
            var songs = data.song;
            for(var s in songs){
              str += '<div class="songp"><a onclick="bdmusic.getsong('+songs[s].songid+')">'+songs[s].songname+' 【'+songs[s].artistname+'】</a></div>';
            }
            $('#songlist').html(str);
          }
        })
      },
      artsong: function(artid){
        var query = 'method=baidu.ting.artist.getSongList&tinguid='+artid;
        bdmusic.query(query,function(data){
          console.log(data);
          var str = '';
          var songs = data.songlist;
          for(var s in songs){
            str += '<div class="songp"><a onclick="bdmusic.getsong('+songs[s].song_id+')"><img src="'+songs[s].pic_small+'"/>'+songs[s].title+'</a></div>';
          }
          $('#songlist').html(str);
        })
      },
      nextpage: function(){
        getList(bdmusic.now_type,bdmusic.offset+bdmusic.sizes,bdmusic.sizes);
      }
    }
